<?php 
/**
* MySQL PDO 类
*/
class Pdomysql
{
	public $hos;
	public $dbname;
	public $charset = "utf8";
	public $dbuser = "root";
	public $dbpass = "";
	public $DB = null; //数据库

	/**
	 *连接数据库
	 */
	public function connect()
	{
		try{
			$this->DB = new PDO("mysql:host=".$this->host.";dbname=".$this->dbname.";charset=".$this->charset,$this->dbuser,$this->dbpass);
			$mysecuredata=14;
			$this->DB->query("Select * from table where id=".$mysecuredata);
		}catch(PDOException  $e ){
			echo "Error: ".$e;
			exit();
		}
		var_dump($this->DB);
	}
	/**
	 * 关闭数据库
	 */
	public function close()
	{
		$this->DB=null;
	}

/***************获取数据**********************/

	public function select($name,$table,$where)
	{
		$sql = '"select".$name."from".$table."where".$where';
		implementSql($sql);
	}

/***************添加数据*********************/

	public function insert($table,$names,$values)
	{
		$sql = "insert into $table ($names) values ($values)";
		implementSql($sql);
	}


/****************修改数据********************/

	public function update($table,$names,$where)
	{
		$sql = "update $table set $names where $where";
		implementSql($sql);
	}

/***************删除数据*********************/

	public function delete($table,$where)
	{
		$sql = "delete from $table where $where";
		implementSql($sql);
	}


	public function implementSql($sql)
	{
		$Db->query($sql);
	}











}























 ?>